// Copyright (C) 2025 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@import "../../../assets/theme";

.pf-node-box {
  display: flex;
  position: absolute;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--pf-color-border);
  border-radius: 8px;
  background-color: var(--pf-color-background);
  box-shadow: 0 2px 4px var(--pf-color-box-shadow);
  cursor: grab;
  transition:
    border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;

  &:hover {
    border-color: #bdbdbd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  &__selected {
    border-width: 2px;
    border-color: var(--pf-color-primary);
    box-shadow: 0 0 12px
      color-mix(in srgb, var(--pf-color-primary) 30%, transparent);
    .pf-node-box__warning-icon {
      border-width: 2px;
    }
  }

  &__invalid,
  &__invalid-query {
    border-color: var(--pf-color-danger);
    background-color: color-mix(
      in srgb,
      var(--pf-color-danger),
      transparent 80%
    );
    color: var(--pf-color-danger);
  }

  &__invalid-response {
    border-color: var(--pf-color-warning);
    background-color: color-mix(
      in srgb,
      var(--pf-color-warning),
      transparent 80%
    );
    color: var(--pf-color-warning);
  }

  &__warning-icon {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    color: inherit;
    background-color: var(--pf-color-background);
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: 1rem;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.pf-node-box__content {
  display: flex;
  flex-direction: column;
}

.pf-node-box__filters {
  margin-top: 0.5rem;
}

.pf-node-box {
  position: absolute;
}

.pf-node-box-add-button {
  position: absolute;
  bottom: -0.5rem;
  right: -0.5rem;
  background-color: var(--pf-color-background);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 1px solid;
  display: none;
  align-items: center;
  justify-content: center;

  .pf-node-box:hover &,
  .pf-node-box__selected & {
    display: flex;
  }
}

.pf-node-box-port {
  z-index: 1;
}
